<%--
  Created by IntelliJ IDEA.
  User: 小柒的Java
  Date: 2021/4/26
  Time: 18:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h1>scope.jsp页面</h1>
<%
    //往四个域中传入数据
    pageContext.setAttribute("key", "神经病");
    request.setAttribute("key", "吴杰");
    session.setAttribute("key", "李鹏");
    application.setAttribute("key", "是狗");
    Cookie cookie = new Cookie("user","isiis");
    response.addCookie(cookie);



%>
    pageContext中是否有值:<%=pageContext.getAttribute("key")%><br>
    request中是否有值:<%=request.getAttribute("key")%><br>
    session中是否有值:<%=session.getAttribute("key")%><br>
    application中是否有值:<%=application.getAttribute("key")%><br>
    <%=request.getHeaderNames()%><br>
    <%=response.getHeader("Content-Type")%><br>
    <%=response.getHeader("Content-Length")%><br>
    <%= request.getHeader("Content-Type")%><br>

<%-- 原来的请求转发 --%>
<%--
    request.getRequestDispatcher("/myjsp.jsp").forward(request,response);
//            response.sendRedirect("/myjsp.jsp");
--%>
<%--
    使用JSP标签进行请求转发
 --%>
<%-- <jsp:forward page="myjsp.jsp">
 </jsp:forward>--%>
</body>
</html>
